package com.leonzhangxf.xml;

import com.leonzhangxf.xml.custom.LeonPrinter;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;

import java.io.IOException;

/**
 * @author leonzhangxf
 * @date 20190603
 */
@ImportResource("classpath:primary-use.xml")
@ComponentScan("com.leonzhangxf.xml")
@Configuration
public class LeonUtilsPrimaryUseStarter {

    public static void main(String[] args) throws IOException {
        AnnotationConfigApplicationContext applicationContext =
            new AnnotationConfigApplicationContext(LeonUtilsPrimaryUseStarter.class);

        LeonPrinter leonPrinter = applicationContext.getBean("leonPrinter", LeonPrinter.class);
        leonPrinter.print(System.out);
        System.out.println();
    }
}
